package com.reptile.service.execute;

import com.reptile.service.BaseExecute;
import com.reptile.util.HttpClientDownPage;
import com.reptile.util.PictureInfoDataUtil;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import java.util.List;


/**
 * wallHaven图片爬取方法实现
 */
@Slf4j
public class WallHavenPicExecute implements BaseExecute {

    @Override
    public List baseExecute() {
        return null;
    }

    @Override
    public List baseExecute(Object data) {
        //从Redis 获取url-异常的情况
       try {
           String text = HttpClientDownPage.sendGet(String.valueOf(data));
           return PictureInfoDataUtil.wallHavenPicParseList(Jsoup.parse(text));
       }catch (Exception e){
            log.error("爬取图片发生异常{}",e);
       }
       return null;
    }
}
